/*
 * @Author: zhang zhijiang 2824735304@qq.com
 * @Date: 2024-12-16 22:05:18
 * @LastEditors: zhang zhijiang 2824735304@qq.com
 * @LastEditTime: 2024-12-16 22:32:27
 * @FilePath: /linux/test_12_16/mykill.hpp
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
#include<iostream>
#include<signal.h>
#include<unistd.h>
#include<cstring>
#include<cstdlib>
using namespace std;
// void mysignal(int sigid)
// {
//     cout<<"this is a capture,id:"<<sigid<<endl;
//     exit(1);
// }
// int main( int argc, const char * argv[])
// {
//     signal(2,mysignal);
//     while(1)
//     {
//         printf("hello linux\n");
//         sleep(1);
//     }
//     return 0;
// }
void usage()
{
    cout<<"usage:\n\t,./mykill signalnumber pid\n";
}
//kill 5 pid
int main(int argc,int argv[])
{
    while(argc!=3)
    {
        usage();
        exit(1);
    }
    int number = stoi(argv[1]);
    int pid = stoi(argv[2]);
    kill(pid,number); 
    return 0;
}